<?php
include_once 'library/confirm/MaterialFilterPost.class.php';

$item = new MaterialFilterPost($translator);
// FETCHING
$tgl_penanaman		=	$_POST['tgl_penanaman'];
$no_pancang 		=	$_POST['no_pancang'];
$no_individu		=	$_POST['no_individu'];
$replika			=	$_POST['replika'];
$usia_saat_tanam	=	$_POST['usia_saat_tanam'];
$kategori_pokok		=	$_POST['kategori_pokok'];
$jenis_tanaman		=	$_POST['jenis_tanaman'];
$cross_asal_pokok	=	$_POST['cross_asal_pokok'];
$penanggung_jawab	=	$_POST['penanggung_jawab'];
$jml_pekerja		=	$_POST['jml_pekerja'];
$biaya_pekerja		=	$_POST['biaya_pekerja'];
$kondisi_awal		=	$_POST['kondisi_awal'];
$catatan			=	$_POST['catatan'];

?>
<div class="title">Konfirmasi - Penanaman</div>
<form name="frm_<?=$subbagian;?>" id="frm_<?=$subbagian;?>" method="post" action="index.php?bagian=<?=$bagian;?>&subbagian=<?=$subbagian;?>&action=confirmed">
    <ul>
    	<li class="header"><span>Identitas Individu</span></li>
        <li><span>
            <label>Tanggal Penanaman:</label>
            <span class="confirm"><?=$tgl_penanaman;?></span>
			<input type="hidden" name="tgl_penanaman" value="<?=$tgl_penanaman;?>" />
        </span></li>
        <li><span>
            <label>No Pancang:</label>
            <span class="confirm"><?=$_POST['no_pancang'];?></span>
			<input type="hidden" name="no_pancang" value="<?=$no_pancang;?>" />
        </span></li>
        <li><span>
            <label>No Individu:</label>
            <span class="confirm"><?=$_POST['no_individu'];?></span>
			<input type="hidden" name="no_individu" value="<?=$no_individu;?>" />
        </span></li>
         <li><span>
            <label>Replika:</label>
            <span class="confirm"><?=$_POST['replika'];?></span>
			<input type="hidden" name="replika" value="<?=$replika;?>" />
        </span></li>
         <li><span>
            <label>Usia saat tanam:</label>
            <span class="confirm"><?=$_POST['usia_saat_tanam'];?></span>
			<input type="hidden" name="usia_saat_tanam" value="<?=$usia_saat_tanam;?>" />
        </span></li>
         <li><span>
            <label>Kategori pokok saat Tanam:</label>
            <span class="confirm"><?=$_POST['kategori_pokok'];?></span>
			<input type="hidden" name="kategori_pokok" value="<?=$kategori_pokok;?>" />
        </span></li>
         <li><span>
            <label>Jenis Tanaman:</label> 
            <span class="confirm"><?=$_POST['jenis_tanaman'];?></span>
			<input type="hidden" name="jenis_tanaman" value="<?=$jenis_tanaman;?>" />
        </span></li>
         <li><span>
            <label>Crossing Asal Pokok:</label> 
            <span class="confirm"><?=$_POST['cross_asal_pokok'];?></span>
			<input type="hidden" name="cross_asal_pokok" value="<?=$cross_asal_pokok;?>" />
        </span></li>
    </ul>
    <ul>
		<li class="header"><span>Pekerja</span></li>
		<li><span>
            <label>Penanggung Jawab:</label> 
            <span class="confirm"><?=$_POST['penanggung_jawab'];?></span>
			<input type="hidden" name="penanggung_jawab" value="<?=$penanggung_jawab;?>" />
        </span></li>
		<li><span>
            <label>Jumlah Pekerja:</label> 
            <span class="confirm"><?=$_POST['jml_pekerja'];?></span>
			<input type="hidden" name="jml_pekerja" value="<?=$jml_pekerja;?>" />
        </span></li>
		<li><span>
            <label>Total Biaya Pekerja:</label> 
            <span class="confirm"><?=$_POST['biaya_pekerja'];?></span>
			<input type="hidden" name="biaya_pekerja" value="<?=$biaya_pekerja;?>" />
        </span></li>
    </ul>
    <ul id="peralatan">
		<li class="header"><span>Peralatan</span></li>
		<li class="desc">
			<span class="col1">Nama Peralatan</span>
			<span class="col2">Jumlah</span>
		</li>
		<?php
		$no = 0;	
		if( isset($item->peralatan['nama_peralatan']) && count($item->peralatan) ){
			foreach($item->peralatan['nama_peralatan'] as $i=>$v){
				$no++;
				$nama   = $v;
				$jumlah = $item->peralatan['jumlah_peralatan'][$i];
		?>
		<li><span>
			<label><?=$no;?></label>
			<span class="confirm_peralatan_nama"><?=$nama;?></span>
			<span class="confirm_peralatan_jumlah"><?=$jumlah;?></span>
			<input type="hidden" id="nama_peralatan[]" name="nama_peralatan[]" value="<?=$nama;?>"/>
			<input type="hidden" id="jml_peralatan[]" name="jml_peralatan[]" value="<?=$jumlah;?>"/>
		</span>
		<?php 
			}
		}
		?>
	</li> 
    </ul>
    <ul>
		<li class="header"><span>Material</span></li>
		<li class="desc">
			<span class="col1">Nama Material</span>
			<span class="col2">Jumlah</span>
			<span class="col3">Satuan</span>
		</li> 
		<?php
		$no 	     = 0;	
		$biaya_total = 0;
		if( isset($item->material['nama_material']) && count($item->material) ){
			foreach($item->material['nama_material'] as $i=>$v){
				$no++;
				$nama   = $item->material['nama_material'][$i];
				$jumlah = $item->material['jumlah_material'][$i];
				$satuan = $item->material['satuan_material'][$i];
				
				$biaya_total += $harga;
		?>
		<li><span>
			<label><?=$no;?></label>
			<span class="confirm_material_nama"><?=$nama;?></span>
			<span class="confirm_material_jumlah"><?=$jumlah;?></span>
			<span class="confirm_material_satuan"><?=$satuan;?></span>
			<input type="hidden" id="nama_material[]" name="nama_material[]" value="<?=$nama;?>"/>
			<input type="hidden" id="jml_material[]" name="jml_material[]" value="<?=$jumlah;?>"/>
			<input type="hidden" id="satuan_material[]" name="satuan_material[]" value="<?=$satuan;?>"/>
		</span>
		<?php 
			}
		}
		?>
	</ul>
	
	<ul>
		<li class="header"><span>Kondisi</span></li>
		<li><span>
            <label>Kondisi Awal:</label> 
			<span class="confirm"><?=$_POST['kondisi_awal'];?></span>
			<input type="hidden" name="kondisi_awal" value="<?=$kondisi_awal;?>" />
        </span></li>
		<li><span>
            <label>Catatan:</label> 
			<span class="confirm"><?=$_POST['catatan'];?></span>
			<input type="hidden" name="catatan" value="<?=$catatan;?>" />
        </span></li>
    </ul>
	<ul>
		<li class="header"><span>Simpan</span></li>
		<li class="button"><span>
			<input type="submit" name="submit" id="submit" value="Simpan Data" class="simpan"/>
			<a class="cancel" href="#" onclick="javascript:history.go(-1);">Batalkan</a>
		</span></li>
	</ul>
</form>